<!DOCTYPE html>
<html>
<head lang="en">
    <base href="${request.contextPath}/"/>
    <meta charset="UTF-8">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,minimum-scale=1.0">
    <title>漠河智慧社区</title>
    <link href="Content/wechat/css/reset.css" rel="stylesheet" type="text/css">
    <link href="Content/wechat/css/tongCheng_xx.css" rel="stylesheet" type="text/css">

    <script src="Content/wechat/js/jquery.min.js"></script>
    <!--字体缩放-->
    <script src="Content/wechat/js/ziti.js"></script>
    <!--end 字体缩放-->
    <!--页码js-->
    <script src="Content/wechat/js/myPagination.js"></script>
    <!--页码-->
    <link href="Content/wechat/css/myPagination.css" rel="stylesheet" type="text/css">
    <script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
    <script>
        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: '${jsApiConfig.appId!}', // 必填，公众号的唯一标识
            timestamp: ${jsApiConfig.timestamp!}, // 必填，生成签名的时间戳
            nonceStr: '${jsApiConfig.nonceStr!}', // 必填，生成签名的随机串
            signature: '${jsApiConfig.signature!}',// 必填，签名
            jsApiList: ['chooseImage', 'uploadImage', 'updateAppMessageShareData', 'onMenuShareAppMessage','updateTimelineShareData'] // 必填，需要使用的JS接口列表
        });
    </script>
    <style type="text/css">
        .qyml_l p i {
            display: inline-block;
            width: 0.3rem;
            height: 0.3rem;
            overflow: hidden;
        }
        .qyml_l p i img {
            width: 100%;
            vertical-align: middle;
        }
        .qyml_l p {
            font-size: 0.24rem;
            color: #949494;
            padding: 0.05rem 0;
        }
    </style>
    <style>
        /*去除百度地图版权*/
        .anchorBL {
            display: none;
        }
    </style>
    <script type="text/javascript"
            src="http://api.map.baidu.com/api?v=3.0&ak=gaymbGh1STIIT2CnWGahmdG7fCXk4nT1"></script>
</head>
<body >
<div class="header">
    <div class="name_up clearfix">
<!--        <a href='tel:1425365457646'>-->
<!--            <img src="Content/wechat/images/tel_01.png">-->
<!--        </a>-->
        <h3>${shop.sname !''}</h3>

    </div>
    <!--头像信息-->

    <!--end 头像信息-->
    <div class="header_xx" style="padding-top: 0.5rem;">
        ${shop.content !''}
    </div>


</div>
<!--评论-->
<div class="header">
    <div class="pingLun">
        <div class="pingLun_title">
<!--            <h4>地址：${shop.communityname !''}${shop.villagename !''}${shop.buildingnumname !''}</h4>-->
            <h4>地址：${shop.buildingnumname !''}</h4>
        </div>
        <div class="qyml_l" style="margin-top: 0.3rem;">
            <div id="container" style="height: 300px;"></div>
        </div>


    </div>
</div>







</body>
<script>

    //创建和初始化地图函数：
    function initMap() {
        createMap();//创建地图
        setMapEvent();//设置地图事件
        // addMapControl();//向地图添加控件
        addMarker();//向地图中添加marker
    }

    //创建地图函数：
    function createMap() {
        var map = new BMap.Map("container");//在百度地图容器中创建一个地图
        var point = new BMap.Point( ${shop.lon !'122.54592335559218'}, ${shop.lat !'52.979069538529444'});//定义一个中心点坐标
        map.centerAndZoom(point, 15);//设定地图的中心点和坐标并将地图显示在地图容器中
        window.map = map;//将map变量存储在全局
    }

    //地图事件设置函数：
    function setMapEvent() {
        map.enableDragging();//启用地图拖拽事件，默认启用(可不写)
        map.enableScrollWheelZoom();//启用地图滚轮放大缩小
        map.enableDoubleClickZoom();//启用鼠标双击放大，默认启用(可不写)
        map.enableKeyboard();//启用键盘上下左右键移动地图
    }

    //地图控件添加函数：
    function addMapControl() {
        //向地图中添加缩放控件
        var ctrl_nav = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_LEFT, type: BMAP_NAVIGATION_CONTROL_LARGE});
        map.addControl(ctrl_nav);
        //向地图中添加缩略图控件
        var ctrl_ove = new BMap.OverviewMapControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT, isOpen: 1});
        map.addControl(ctrl_ove);
        //向地图中添加比例尺控件
        var ctrl_sca = new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT});
        map.addControl(ctrl_sca);
    }

    //标注点数组
    var markerArr = ${mapJson!};
    console.log(markerArr);
    //创建marker
    function addMarker() {
       // for (var i = 0; i < markerArr.length; i++) {
            //var json = markerArr[i];
            var json = markerArr;
            var point = new BMap.Point(json.lon, json.lat);
            var iconImg = createIcon(json.icon);
            var marker = new BMap.Marker(point, {icon: iconImg});
            var iw = createInfoWindow(0);
            var label = new BMap.Label(json.sname, {"offset": new BMap.Size(5 - 6 + 10, -20)});
            marker.setLabel(label);
            map.addOverlay(marker);
            label.setStyle({
                borderColor: "#808080",
                color: "#333",
                cursor: "pointer"
            });

            (function () {
                var index = 0;
                var _iw = createInfoWindow(0);
                var _marker = marker;
                // _marker.addEventListener("click", function () {
                //     this.openInfoWindow(_iw);
                // });
                _iw.addEventListener("open", function () {
                    _marker.getLabel().hide();
                })
                _iw.addEventListener("close", function () {
                    _marker.getLabel().show();
                })
                // label.addEventListener("click", function () {
                //     _marker.openInfoWindow(_iw);
                // })
                if (!!json.isOpen) {
                    label.hide();
                    _marker.openInfoWindow(_iw);
                }
            })()
      //  }
    }

    // //创建InfoWindow
    function createInfoWindow(i) {
       // var json = markerArr[i];
        var json = markerArr;
        console.log(json)
        var text = "<b class='iw_poi_title' title='" + json.sname + "'><font color='red'>" + json.sname + "</font></b>" +
            "<div class=''>联 系 人:" + json.sname + "</div>"+
            "<div class=''>联系电话:<a href='tel:"+json.sphone+"'>" + json.sphone + "（点击拨打）</a></div>"+
            "<div class=''>联系地址:" + json.buildingnumname + "</div>";
        var iw = new BMap.InfoWindow(text);
        return iw;
    }

    //创建一个Icon
    function createIcon(json) {
        // var icon = new BMap.Icon("img/2.png", new BMap.Size(json.w,json.h),{imageOffset: new BMap.Size(-json.l,-json.t),infoWindowOffset:new BMap.Size(json.lb+5,1),offset:new BMap.Size(json.x,json.h)})
        var myIcon = new BMap.Icon("../../../../Content/wechat/images/shangpu.png", new BMap.Size(20, 20), {
            anchor: new BMap.Size(10, 50),
            imageOffset: new BMap.Size(0, 0) // 设置图片偏移
        });
        return myIcon;
    }

    initMap();//创建和初始化地图



</script>

<script>
    var imgUrl = "${wxPortURl!}/Content/wechat/mhlogo.png";
    var link = "${wxPortURl!}/wechat/login?state=QCSJ_${shop.id !''}";
    var title = "${shop.sname !''}";
    var desc ="电话：${shop.sphone !''}";
    wx.ready(function () {   //需在用户可能点击分享按钮前就先调用
        wx.updateAppMessageShareData({
            title: title, // 分享标题
            desc: desc, // 分享描述
            link: link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            imgUrl: imgUrl, // 分享图标
            success: function () {

            }
        })

        wx.updateTimelineShareData({
            title: title, // 分享标题
            link: link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            imgUrl: imgUrl, // 分享图标
            success: function () {

            }
        })
    });
    function getSimpleText(html) {
        var re1 = new RegExp("<.+?>", "g");//匹配html标签的正则表达式，"g"是搜索匹配多个符合的内容
        var msg = html.replace(re1, '');//执行替换成空字符
        return msg;
    }
</script>
</html>